Xbasic

SYS_SHELL Function

Syntax

N SYS_SHELL(C command_line [,N window_style])

Arguments

command_lineCharacter

The program to run as well as any additional arguments for the program. Arguments used by the program are separated by space characters:

program_name [argument1 ... argumentN]

window_styleNumeric

Optional. Default = 2. Determines the mode of the window in which the application runs. The Window_Mode options are:

Window Mode
Description
1

Normal

2

Minimized

3

Maximized

Returns

hwndNumeric

Returns the hwnd of the program that was run.

Description

Run a program, returning the hwnd of the program run.

Discussion

The SYS_SHELL() function executes the specified Windows program (program_name). Your Xbasic code continues to run, without waiting for the SYS_SHELL() command to finish. The optional Window_Mode parameter is a number that determines the mode of the window in which the application runs. If you omit this parameter, the window will be minimized by default. Contrast this command with the higher level SYS_OPEN() command, which is equivalent to double clicking on a file in the Windows Explorer.

To cause your Xbasic script to wait for the SYS_SHELL() command to finish, use SYS_SHELL_WAIT().

When used in web or mobile applications, you cannot run any programs with SYS_SHELL() that require user input. SYS_SHELL() is executed on the Application Server in web and mobile applications, and the user cannot interact with the script.

Example

This script displays the A5.INI file from the windows directory using the Windows Notepad application.

x = sys_shell("c:\windows\notepad.exe c:\windows\a5.ini",1)

This script decodes an alias that contains the path to where the program to run is installed. Assume you have a setting that says: System = C:\WINNT\System32\

sys_shell(filename_decode("[System]Calc.exe"),1)

See Also